<!DOCTYPE html>
<html>
<body>
<h2>The XMLHttpRequest Object</h2>
<button type="button" onclick="getSelfHtmlForLoad()">getSelfHtml</button><br>
<textarea id="demo" rows="20" cols="100"></textarea>
<script>

function getSelfHtml(){
  var http = new XMLHttpRequest();
  http.onload = function(){
    document.getElementById("demo").value = this.responseText;
  }
  http.open("GET", "/c3/get.html", true)
  http.send();
}


function getSelfHtmlByReadystateChange() {
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange=function() {
    if (this.readyState == 4 && this.status == 200) {
      document.getElementById("demo").value = this.responseText;
    }
  };
  xhttp.open("GET", "/c3/get.html", true)
  xhttp.send();
}

</script>

</body>
</html>
